/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.manchester.biology.eqhei.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mlwyatt
 */
@Entity
@Table(name = "EvaluationSection")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EvaluationSection.findAll", query = "SELECT e FROM EvaluationSection e"),
    @NamedQuery(name = "EvaluationSection.findById", query = "SELECT e FROM EvaluationSection e WHERE e.id = :id")})
public class EvaluationSection implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 36)
    @Column(name = "id")
    private String id;
    
    
    @JoinColumn(name = "userName", referencedColumnName = "userName",insertable=false,updatable=false)
    @ManyToOne
    private User userName;
    
    
    @JoinColumn(name = "UTM", referencedColumnName = "UTM",insertable=false,updatable=false)
    @ManyToOne
    private StreamReach utm;
    
    
    @JoinColumns({
        @JoinColumn(name = "sectionName", referencedColumnName = "sectionName",insertable=false,updatable=false),
        @JoinColumn(name = "attributeSetName", referencedColumnName = "attributeSetName",insertable=false,updatable=false)})
    @ManyToOne
    private Section section;
    
    
    @JoinColumns({
        @JoinColumn(name = "UTM", referencedColumnName = "UTM"),
        @JoinColumn(name = "userName", referencedColumnName = "userName"),
        @JoinColumn(name = "evaluationTime", referencedColumnName = "evaluationTime"),
        @JoinColumn(name = "sectionName", referencedColumnName = "sectionName")})
    @ManyToOne
    private Evaluation evaluation;
    
    
    @JoinColumns({
        @JoinColumn(name = "attributeSetName", referencedColumnName = "attributeSetName",insertable=false,updatable=false),
        @JoinColumn(name = "attributeName", referencedColumnName = "attributeName",insertable=false,updatable=false)})
    @ManyToOne
    private AttributeSet attributeSet;
    

    public EvaluationSection() {
    }

    public EvaluationSection(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public User getUserName() {
        return userName;
    }

    public void setUserName(User userName) {
        this.userName = userName;
    }

    public StreamReach getUtm() {
        return utm;
    }

    public void setUtm(StreamReach utm) {
        this.utm = utm;
    }

    public Section getSection() {
        return section;
    }

    public void setSection(Section section) {
        this.section = section;
    }

    public Evaluation getEvaluation() {
        return evaluation;
    }

    public void setEvaluation(Evaluation evaluation) {
        this.evaluation = evaluation;
    }

    public AttributeSet getAttributeSet() {
        return attributeSet;
    }

    public void setAttributeSet(AttributeSet attributeSet) {
        this.attributeSet = attributeSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EvaluationSection)) {
            return false;
        }
        EvaluationSection other = (EvaluationSection) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.manchester.biology.eqhei.business.EvaluationSection[ id=" + id + " ]";
    }
    
}
